// pages/my/myInfo_admin/myInfo_admin.js
const app = getApp();
const API = require('../../../API/api.js');
const util = require('../../../utils/util.js')

Page({

    /**
     * 页面的初始数据
     */
    data: {
        Height: app.globalData.Height,
        isName: '去实名',
        isCode: '未设置',
        isTel: ''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var name, code, tel;
        API.getMyUserInfo({
            userId: wx.getStorageSync('userId')
        }).then((res) => {
            console.log(res)
            name = res.data.name;
            code = res.data.securityCode;
            tel = res.data.mobile;
            if (name) {
                this.setData({
                    isName: '已实名'
                })
            }
            if (code) {
                this.setData({
                    isCode: '已设置'
                })
            }
            if (tel) {
                this.setData({
                    isTel: util.plusxing(tel, 3, 4)
                })
            }
        })

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    },
    gotoUserRealName() {
        if (this.data.isName == '去实名') {
            return wx.navigateTo({
                url: '../../my/myInfo_admin_info/myInfo_admin_info',
            })
        } else {
            return wx.navigateTo({
                url: '../../my/myInfo_admin_info_verify_pass/myInfo_admin_info_verify_pass',
            })
        }
    },
    gotoUserVerift() {
        wx.navigateTo({
            url: '../../my/myInfo_admin_security_code/myInfo_admin_security_code',
        })
    },
    gotoUserChangeMobile() {
        wx.navigateTo({
            url: '../../my/myInfo_admin_change_mobile/myInfo_admin_change_mobile',
        })
    }
})
